package com.example.demo.mapper;

import com.example.demo.entity.ScSource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface ScSourceMapper extends BaseMapper<ScSource> {

    @Select("SELECT `name`, `day`, `department`, MIN(time) AS min, MAX(time) AS max FROM sc_source " +
            "WHERE day <= #{date2} AND day >= #{date1} GROUP BY `name`, `day`, `department` " +
            "ORDER BY `name`;")
    List<Map<String, Object>> data(String date1, String date2);
}




